﻿@*<script type="text/javascript" src="https://www.google.com/jsapi"></script>*@
@model PagedList.IPagedList<CultuRAM.Models.Statistic>


@{
    ViewBag.Title = "Dados Estatísticos";

}

@*@Html.Partial("_Messages")*@

    @if (Model.FirstOrDefault() != null)
    {
        <!-- LIST MODE -->
        <div id="ListMode">
            <table id="tabResult" class="table table-hover table-striped table-bordered" style="width: 100%;">
                <tr>
                    <th>
                        Designação
                    </th>
                    <th style="text-align: center;">     
                        N.º de Eventos
                    </th>
                </tr>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => item.DataName)
                        </td>
                        <td style="text-align: center;">
                            <b>@Html.DisplayFor(modelItem => item.DataCount)</b>
                        </td>
                    </tr>
                }

            </table>

            <div class="row pagination-botton">
                <div class="">
                    @* Pagination *@
                    <div class="pagination" style="margin: 0; padding-left: 750px;">
                    @*<div class="pagination float-right" style="margin: 0; float: right; padding-right: 30px;">*@
                        <ul>
                            @if (Model.HasPreviousPage)
                            {
                                <li>
                                    @Ajax.ActionLink("«", "StaticDate", new {stringFilter = ViewBag.stFilter, page = 1 },
                                                     new AjaxOptions
                                                         {
                                                             UpdateTargetId="resultData", 
                                                             InsertionMode = InsertionMode.Replace, 
                                                             HttpMethod = "GET" 
                                                         }, new { @class = ""}) 
                                </li>
                
                                <li>
                                    @Ajax.ActionLink("<", "StaticDate", new {stringFilter = ViewBag.stFilter, page = Model.PageNumber - 1},
                                                     new AjaxOptions
                                                         {
                                                             UpdateTargetId="resultData", 
                                                             InsertionMode = InsertionMode.Replace, 
                                                             HttpMethod = "GET" 
                                                         }, new { @class = ""}) 
                                </li>
                                <li class="">
                                    <a href="#" data-original-title="" title="" class="">
                                        Página <b> @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)</b> de <b> @Model.PageCount </b>
                                    </a>
                                </li>  
                            }
                            else
                            {
                                <li class="disabled"><a href="#" data-original-title="" title="" class="">«</a></li> 
                                <li class="disabled"><a href="#" data-original-title="" title="" class=""><</a></li> 
                                <li class="">
                                    <a href="#" data-original-title="" title="" class="disabled">
                                        Página <b> @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)</b> de <b> @Model.PageCount </b>
                                    </a>
                                </li> 
                            }
           
                            @if (Model.HasNextPage)
                            {
                                <li>
                                    @Ajax.ActionLink(">", "StaticDate", new {stringFilter = ViewBag.stFilter, page = Model.PageNumber + 1 },
                                                     new AjaxOptions
                                                         {
                                                             UpdateTargetId="resultData", 
                                                             InsertionMode = InsertionMode.Replace, 
                                                             HttpMethod = "GET" 
                                                         }, new { @class = ""}) 
                                </li>
                                <li>
                                    @Ajax.ActionLink("»", "StaticDate", new {stringFilter = ViewBag.stFilter, page = Model.PageCount},
                                                     new AjaxOptions
                                                         {
                                                             UpdateTargetId="resultData", 
                                                             InsertionMode = InsertionMode.Replace, 
                                                             HttpMethod = "GET" 
                                                         }, new { @class = ""}) 
                                </li>
                            }
                            else
                            {
                                <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">></a></li> 
                                <li class="disabled"><a href="#" data-original-title="" title="" class="disabled">»</a></li>
                            }
                        </ul>

                    </div>
                </div>
            </div>
        </div>
    
        <!-- CHART MODE -->
        <div id="ChartMode" style="display: none;" class="graficoGrande">
            @*  *@
            <div id="chart_div" >
                @Html.Raw(ViewBag.DataChart) 
            </div>
        </div>
  
    }
    else
    {
        <div class="alert alert-warning"><br/><b>Não foram encontrados dados, para o critério e filtro(s) aplicado(s)!</b><br/>&nbsp;</div>
    }
    